import React ,{Component} from 'react';
import { Modal, Button } from 'antd';

export default class Index extends Component {

	constructor(props){
		super(props);
		this.state = {
			visible:false
		}
	}

	onView = () => {
		let {view=true,src} = this.props;
		if(!view) return
		this.setState({visible:true})
		// Modal.success({
		//     title: '图片预览',
		//     iconType:'',
		//     wrapClassName:'duhuijie',
		//     content: (
		//     	<img src={'http://oa.simiie.com/abs/uploads/data/files/settle_account/b9f4d57bfd7b0118c3ffc99b59958d05.jpg'} />
		//     ),
		// });
	}
	hideModal = () => {
		this.setState({visible:false})
	}

	render(){
		let {view=true,src='',width=80,height=80,alt=''}= this.props;
		console.log(this.props ,'---')
		return (
			<div>
				<div onClick={this.onView} style={view?{cursor:'pointer'}:{}}>
					<img 
						src={'http://oa.simiie.com/abs/uploads/data/files/settle_account/b9f4d57bfd7b0118c3ffc99b59958d05.jpg'} 
						width={width} 
						height={height} 
						alt={alt} 
					/>
				</div>
				<Modal
		          title="图片预览"
		          visible={this.state.visible}
		          wrapClassName={'image-view-modal'}
		          onCancel={this.hideModal}
		          footer={[
		          	<Button type='primary' onClick={this.hideModal}>确定</Button>
		          ]}
		        >
		          <div>
		          	<img 
		          		style={{maxWidth:'100%'}}
		          		src={'http://oa.simiie.com/abs/uploads/data/files/settle_account/b9f4d57bfd7b0118c3ffc99b59958d05.jpg'} 
		          	/>
		          </div>
		        </Modal>
			</div>
		)
	}
}